<template>
    <div>
        <div class="student">
            <div class="student-1">
                <img src="@/assets/img/join-1.png" alt=""/>
            </div>
            <h2>外包合作</h2>
            <div class="monomer">
                <div class="line">
                    <span></span>
                    <h2>单体</h2>
                </div>
                <ul ref="list">
                    <li v-for="val in arrList" :key="val.t_content ">
                        <img :src="val.t_student_works_imgurl" alt="">
                    </li>
                </ul>
                <div class="more">
                    <a href="javascript:;" @click="toLoad">加载更多</a>
                </div>
            </div>
            <!-- 概念 -->
            <div class="concept">
                <div class="line">
                    <span></span>
                    <h2>概念</h2>
                </div>
                <ul ref="list2">
                    <li v-for="val in arrList2" :key="val.t_content">
                        <img :src="val.t_student_works_imgurl" alt="">
                    </li>
                </ul>
                <div class="more">
                    <a href="javascript:;" @click="toLoad2">加载更多</a>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
import { getCurrentInstance, ref } from 'vue'
const { proxy } = getCurrentInstance()
const page = ref(1)
const page2 = ref(1)
const list = ref(null)
const list2 = ref(null)
const arrList = ref([])
const arrList2 = ref([])
async function showData (id, arr, page) {
    const { data } = await proxy.$http.get('https://yami.h5.yscase.com/yanjia/student/works?catalog_id=' + id + '&page= ' + page + '')
    data.data.forEach(val => {
        arr.push(val)
    })
}
showData(1, arrList.value, page.value)
showData(2, arrList2.value, page2.value)
function toLoad () {
    page.value++
    proxy.$refs.list.style.height = 416 * page.value + 'px'
    showData(1, arrList.value, page.value)
}
function toLoad2 () {
    page2.value++
    proxy.$refs.list2.style.height = 416 * page2.value + 'px'
    showData(1, arrList2.value, page2.value)
}
</script>
<style lang="less" scoped>
#app {
    background-color: #f4f4f4;
}
* {
    padding: 0;
    margin: 0;
}
li {
    list-style: none;
}
a {
    text-decoration: none;
}
.student {
    position: relative;
    background-color: #f4f4f4;
    padding: 0 330px;
    box-sizing: border-box;
    .line {
        width: 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        margin-bottom: 30px;
        span {
          display: block;
          width: 8px;
          height: 46px;
          background-color: #353535;
          margin-right: 10px;
        }
        h2 {
          font-size: 40px;
          line-height: 40px;
          color: #353535;
          font-weight: 500;
        }
    }
    .student-1 {
        width: 100%;
        height: 199px;
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        img {
            width: 100%;
            height: 100%;
        }
    }
    >h2 {
        position: relative;
        z-index: 1;
        font-size: 52px;
        color: #ededed;
        height: 199px;
        line-height: 199px;
    }
    .more {
            width: 300px;
            height: 67px;
            background: #202022;
            margin: 55px auto 0;
            a {
              text-align: center;
              line-height: 67px;
              font-size: 21px;
              color: #fff;
              text-decoration: none;
            }
        }
    ul {
        display: flex;
        flex-wrap: wrap;
        height: 416px;
        align-items: center;
        justify-content: space-between;
        li {
            width: 200px;
            height: 200px;
            overflow: hidden;
            img {
                width: 100%;
            }
        }
    }
    .monomer {
        margin-top: 50px;
        padding-bottom: 150px;
    }
    .concept,
    .black-white {
        padding-bottom: 150px;
    }
}
</style>
